/*!
 * Jodit Editor (https://xdsoft.net/jodit/)
 * Released under MIT see LICENSE.txt in the project root for license information.
 * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
 */

@import (reference) '../../styles/variables';
@import (reference) '../../styles/mixins';

.jodit-dialog {
	.font();

	&_moved_true {
		user-select: none;
	}

	position: absolute;
	display: none;
	width: 0;
	height: 0;
	box-sizing: border-box;
	border: 0;
	will-change: left, top, width, height;

	* {
		box-sizing: border-box;
	}

	.jodit_elfinder {
		&,
		& * {
			box-sizing: initial;
		}
	}

	&__overlay {
		position: fixed;
		z-index: var(--z-index-dialog-overlay);
		top: 0;
		left: 0;
		display: none;
		overflow: auto;
		width: 100%;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		text-align: center;
		white-space: nowrap;
	}

	&_static_true &__overlay {
		display: none;
	}

	&_modal_true &__overlay {
		display: block;
	}

	&_active_true {
		display: block;
	}

	&__panel {
		position: fixed;
		z-index: var(--z-index-dialog);
		top: 0;
		left: 0;
		display: flex;

		min-width: 200px;
		max-width: 100%;
		min-height: 100px;
		max-height: 100%;

		flex-flow: column nowrap;

		background-color: #fff;
		--box-shadow-blur: calc(var(--padding-default) * 2);
		--box-shadow-1: 0 var(--padding-default) var(--box-shadow-blur)
			rgba(0, 0, 0, 0.19);

		box-shadow: var(--box-shadow-1), 0 6px 6px rgba(0, 0, 0, 0.23);
		text-align: left;

		white-space: normal;

		@media (max-width: @screen-xs) {
			top: 0 !important;
			left: 0 !important;
			width: 100% !important;
			max-width: 100%;
			height: 100% !important;
		}
	}

	&_static_true {
		position: static;
		display: block;
		width: auto;
		height: auto;
		box-sizing: border-box;
	}

	&_static_true &__panel {
		position: relative;
		top: auto !important;
		left: auto !important;
		width: 100% !important;
	}

	&_theme_dark,
	&_theme_dark &__panel {
		background-color: var(--dark_background_darknes);
		color: var(--dark-text-color);
	}

	&__header {
		display: flex;
		min-height: 50px;
		justify-content: space-between;
		border-bottom: 1px solid var(--color-border);
		cursor: move;
		text-align: left;

		@media (max-width: @screen-xs) {
			flex-direction: column;
		}

		&-toolbar,
		&-title {
			display: flex;
			flex-shrink: 3;
			align-items: center;
			padding: 0 var(--padding-default);
			margin: 0;
			font-size: 18px;
			font-weight: 400;
			line-height: 48px;
			vertical-align: top;
		}

		&-toolbar {
			@media (max-width: @screen-xs) {
				padding-left: 0;
			}
		}

		&-button {
			height: 48px;
			flex-basis: 48px;
			color: #222;
			font-size: 28px;
			line-height: 48px;
			text-align: center;
			text-decoration: none;
			transition: background-color 0.2s ease 0s;

			&:hover {
				background-color: var(--color-background-button-hover);
			}
		}

		.jodit_toolbar {
			border: 0;
			background: transparent;
			box-shadow: none;

			> li.jodit-toolbar-button {
				.jodit-input {
					width: auto;
					padding-left: var(--padding-default);
				}
			}
		}
	}

	&_slim_true &__header {
		min-height: 10px;

		&-toolbar,
		&-title {
			padding: 0 calc(var(--padding-default) / 4);
		}
	}

	&_theme_dark &__header {
		border-color: var(--color-dark);
	}

	&_fullsize_true &__header {
		cursor: default;
	}

	&__content {
		overflow: auto;
		min-height: 100px;
		flex: 1;

		.jodit-form__group {
			padding: 0 var(--padding-default);
			margin-bottom: calc(var(--padding-default) * 1.5);

			&:first-child {
				margin-top: var(--padding-default);
			}

			label + .jodit-select,
			label + .jodit-grid,
			label + .jodit-input_group,
			label + input {
				margin-top: calc(var(--padding-default) / 2);
			}

			.jodit-input_group {
				display: table;
				width: 100%;
				border-collapse: separate;

				> * {
					display: table-cell;
					height: 34px;
					vertical-align: middle;
				}

				> input {
					margin: 0 !important;

					&:not([class*='col-']) {
						width: 100%;
					}
				}

				&-buttons {
					width: 1%;
					font-size: 0;
					vertical-align: middle;
					white-space: nowrap;

					> .jodit-button {
						height: 34px;
						border: 1px solid var(--color-border);
						margin-left: -1px;
						border-radius: 0;
						line-height: 34px;
					}
				}
			}
		}
	}

	&__footer {
		display: none;
		flex-wrap: nowrap;
		justify-content: space-between;
		padding: var(--padding-default);

		button {
			margin-right: calc(var(--padding-default) / 2);

			&:last-child {
				margin-right: 0;
			}
		}
	}

	&__column {
		display: flex;
	}

	&__resizer {
		.resize-handle();
	}

	@media (max-width: @screen-xs) {
		&__resizer {
			display: none;
		}
	}

	&_prompt {
		min-width: 200px;
		max-width: 300px;
		padding: var(--padding-default);
		word-break: break-all;

		label {
			display: block;
			margin-bottom: calc(var(--padding-default) / 2);
		}
	}

	&_alert {
		min-width: 200px;
		max-width: 300px;
		padding: var(--padding-default);
		word-break: break-all;
	}

	.jodit-dialog_footer_true &__footer {
		display: flex;
	}
}

.jodit_fullsize .jodit-dialog__panel {
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;

	.jodit-dialog__resizer {
		display: none;
	}
}
